home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-30 | 1.3 KB | 33 lines | [TEXT/GEOL] |
- Item forwarded by LEFFLER1 to RON.METZKER
-
- Item 3720290 28-March-90 10:15PST
-
- From: PALEVICH1 Palevich, John
-
- To: CPLUS.DEV$ C++ Interest List--Developers
- CPLUS.APPLE$ C++ Interest List--Apple Employees
-
- Sub: RE Fast allocation
-
- Don Park gives times for various memory allocation mechanisms:
-
- 1. NewPtr/DisposPtr = 461 ticks
- 2. HandleObject = 128 ticks
- 3. new/delete = 109 ticks
- 4. malloc/free = 85 ticks
- 5. Arena = 15 ticks
-
- Don was puzzled why HandleObject was so much faster than NewPtr/DisposPtr. I
- think the reason is that HandleObject allocates a relocatable block, (using
- NewHandle). Relocatable blocks are usually faster to allocate than
- non-relocatable blocks. This is because the Memory Manager takes extra pains
- to allocate a non-relocatable block at the bottom of the heap. The Memory
- Manager will even move relocatable blocks upward to make room for a new
- non-relocatable block. This is done to minimize heap fragmentation. A side
- effect of this extra movement is that NewPtr calls are usually slower than
- NewHandle calls.
-
- See "The Secret Life of the Memory Manager", by Richard Clark, in the
- soon-to-be-published second issue of Develop magazine for more details.
-
-